package com.burgeon.backend.EnterpriseWeChat.controller;

import com.burgeon.backend.EnterpriseWeChat.entity.IntegralGoods;
import com.burgeon.backend.EnterpriseWeChat.entity.Vip;
import com.burgeon.backend.EnterpriseWeChat.service.EWIntegralGoodsService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("ewapp/integral")
public class EWIntegralGoodsController extends EWBaseController {
    @Autowired
    private EWIntegralGoodsService ewIntegralGoodsService;


    /**
     * 获取积分活动邀约商品列表
     * @param token
     * @return
     */
    @RequestMapping("GetIntegralGoods")
    public ResponseResult<List<IntegralGoods>> GetIntegralGoods(String token, int page){
        List<IntegralGoods> data = ewIntegralGoodsService.GetIntegralGoods(token,page);
        return new ResponseResult<>(SUCCESS,data);
    }


    /**
     * 搜索是商品，精准
     * @param token
     * @param content
     * @return
     */
    @RequestMapping("FindIntegralGoodsByCode")
    public ResponseResult<List<IntegralGoods>> FindIntegralGoodsByCode(String token, String content, int page){
        List<IntegralGoods> data = ewIntegralGoodsService.FindIntegralGoodsByCode(token,content,page);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 本商品符合的顾客页面，商品
     * @param id
     * @param token
     * @return
     */
    @RequestMapping("GetIntegralGoodsById")
    public ResponseResult<IntegralGoods> GetIntegralGoodsById(String id, String token){
        IntegralGoods data = ewIntegralGoodsService.GetIntegralGoodsById(id, token);
        return new ResponseResult<>(SUCCESS,data);
    }


    /**
     * 符合商品积分的会员列表
     * @param empId
     * @param integral
     * @param token
     * @param page
     * @param code
     * @return
     */
    @RequestMapping("GetIntegralVipByEmp")
    public ResponseResult<List<Vip>> GetIntegralVipByEmp(String empId, String integral, String token, int page, String code){
        List<Vip> data = ewIntegralGoodsService.GetIntegralVipByEmp(empId, integral, token, page, code);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 已邀约未邀约
     * @param empId
     * @param integral
     * @param token
     * @param page
     * @param code
     * @param type
     * @return
     */
    @RequestMapping("GetIntegralVipByType")
    public ResponseResult<List<Vip>> GetIntegralVipByType(String empId, String integral, String token, int page, String code, String type){
        List<Vip> data = ewIntegralGoodsService.GetIntegralVipByType(empId, integral, token, page, code,type);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 总数，已邀约数
     * @param empId
     * @param integral
     * @param token
     * @param code
     * @return
     */
    @RequestMapping("GetCounts")
    public ResponseResult<HashMap> GetCounts(String empId, String integral, String token, String code){
        HashMap data = ewIntegralGoodsService.GetCounts(empId, integral, token, code);
        return new ResponseResult<>(SUCCESS,data);
    }



}
